import { defineStore } from 'pinia'
import { getAddress } from '@/api'
import { ref } from 'vue'
const useAddress = defineStore('address', () => {
    const address= ref([])
    const loadAddress = async() =>{
        address.value = await getAddress()
        // console.log(address.value);
    }
    const delAllAddress = () =>{
        address.value=[]
    }
    const addressValue = () =>{
        // console.log(address.value);
        return address.value
    }
    return { address, loadAddress, delAllAddress, addressValue }
    }, {
        persist: {
        enabled: true,
        strategies: [
        {
            key: 'address',
            storage: localStorage
        }]
    }
})
export default useAddress